timeout: 600
- os: osx
compiler: clang
- env: QT_VERSION="5.9.9"
+ env:
+ - QT_VERSION="5.9.9"
+ - QT_INSTALL_METHOD="installer"
cache:
directories:
- $HOME/Cache
- os: osx
osx_image: xcode10.3
compiler: clang
- env: QT_VERSION="5.12.9"
+ env:
+ - QT_VERSION="5.12.9"
+ - QT_INSTALL_METHOD="installer"
+ cache:
+ directories:
+ - $HOME/Cache
+ timeout: 600
+ - os: osx
+ osx_image: xcode11.6
+ compiler: clang
+ env:
+ - QT_VERSION="5.15.0"
+ - QT_INSTALL_METHOD="artifactory"
cache:
directories:
- $HOME/Cache
install:
- if [ "${TRAVIS_OS_NAME}" = "linux" ] && [ "${BUILD_TYPE}" = "local" ]; then ./tools/travis_install_linux_local ${QT_VERSION} && source ${HOME}/Cache/qt-${QT_VERSION}.env; fi
- - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then ./tools/travis_install_osx ${QT_VERSION} && source ${HOME}/Cache/qt-${QT_VERSION}.env; fi
+ - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then ./tools/travis_install_osx ${QT_VERSION} ${QT_INSTALL_METHOD} && source ${HOME}/Cache/qt-${QT_VERSION}.env; fi
script:
- if [ "${TRAVIS_OS_NAME}" = "linux" ] && [ "${BUILD_TYPE}" = "coverage" ]; then ./tools/travis_script_linux_coverage; fi
--- /dev/null
+#!/bin/bash -ex
+
+if [ $# -ne 1 ]; then
+ echo "$0 version"
+ exit 1
+fi
+version=${1}
+sourcetype=tar
+#flavor=debug
+flavor=release
+#flavor=debug-and-release
+
+buildroot=$(pwd)/qt-${version}-${flavor}-${sourcetype}
+mkdir "$buildroot"
+sourcedir=${buildroot}/source
+builddir=${buildroot}/build
+installdir=/Users/travis/Cache/Qt
+archive=qt-${version}-${flavor}-macos.tar.xz
+
+if [ -e "${sourcedir}" ]; then
+ echo "source directory \"${sourcedir}\" already exits."
+ exit 1
+fi
+if [ -e "${builddir}" ]; then
+ echo "build directory \"${builddir}\" already exits."
+ exit 1
+fi
+if [ -e "${installdir}" ]; then
+ echo "install directory \"${installdir}\" already exits."
+ exit 1
+fi
+
+if [ "${sourcetype}" == "git" ]; then
+ git clone git://code.qt.io/qt/qt5.git "${sourcedir}"
+else
+ mkdir -p "${sourcedir}"
+ versionmm=$(echo "${version}" | cut -d. -f1,2)
+ if [ ! -e "qt-everywhere-src-${version}.tar.xz" ]; then
+ wget -nv "https://download.qt.io/archive/qt/${versionmm}/${version}/single/qt-everywhere-src-${version}.tar.xz"
+ fi
+ tar -x --strip-components 1 --xz --directory "${sourcedir}" --file "qt-everywhere-src-${version}.tar.xz"
+fi
+cd "${sourcedir}"
+
+# exclude modules without some kind of LGPL license.
+# virtualkeyboard is pretty sticky, it gets deployed if it exists and you use Gui.
+excludes=( \
+qtcharts \
+qtdatavis3d \
+qtlottie \
+qtnetworkauth \
+qtquick3d \
+qtvirtualkeyboard \
+qtwebglplugin \
+)
+
+# also some modules we don't use
+excludes+=( \
+qtpurchasing \
+qtscript \
+)
+
+# other modules we don't want
+# the tarballs don't include these modules, but git does
+excludes+=( \
+qtqa \
+)
+
+if [ "${sourcetype}" == "git" ]; then
+ if true; then
+ # tagged when released
+ git checkout "v${version}"
+ else
+ # branch, before tagged
+ git checkout "${version}"
+ fi
+ modules=essential,addon,-$(echo "${excludes[@]}" | sed 's/ /,-/g')
+ echo "$modules"
+ perl init-repository --module-subset="${modules}"
+else
+ for component in "${excludes[@]}"
+ do
+ /bin/rm -fr "${component}"
+ done
+fi
+
+mkdir -p "${builddir}"
+cd "${builddir}"
+"${sourcedir}/configure" --prefix="${installdir}/${version}/clang_64" -opensource -confirm-license -nomake examples -nomake tests -${flavor}
+make -j4
+make install
+
+licenses=( \
+"${sourcedir}/LICENSE.FDL" \
+"${sourcedir}/LICENSE.GPLv2" \
+"${sourcedir}/LICENSE.GPLv3" \
+"${sourcedir}/LICENSE.LGPLv21" \
+"${sourcedir}/LICENSE.LGPLv3" \
+"${sourcedir}/LICENSE.QT-LICENSE-AGREEMENT" \
+)
+
+mkdir "${installdir}/Licenses"
+for license in "${licenses[@]}"
+do
+ cp "${license}" "${installdir}/Licenses"
+done
+
+tar -c -C "$(dirname ${installdir})" --xz -f "${archive}" "$(basename ${installdir})"
+echo 'curl -u "${ARTIFACTORY_USER}:${ARTIFACTORY_API_KEY}" -X PUT "${ARTIFACTORY_BASE_URL}/'${archive}\" -T \"${builddir}/${archive}\"
+
+#iv=$(openssl rand -hex 8)
+#openssl aes-256-cbc -e -md sha512 -iv $iv -in ${archive} -out ${archive}.${iv}
+
#debug failed install
function debug() {
- cat ${CACHEDIR}/qt-${QT_VERSION}.env
- find ${CACHEDIR}/Qt -maxdepth 3 -ls
- cat ${CACHEDIR}/Qt/InstallationLog.txt
- cat ${CACHEDIR}/Qt/components.xml
+ cat "${CACHEDIR}/qt-${QT_VERSION}.env"
+ find "${CACHEDIR}" -maxdepth 3 -ls
+ cat "${CACHEDIR}/Qt/InstallationLog.txt"
+ cat "${CACHEDIR}/Qt/components.xml"
echo "$1" >&2
exit 1
}
function validate() {
(
set +e
- source ${CACHEDIR}/qt-${QT_VERSION}.env
+ # shellcheck source=/dev/null
+ source "${CACHEDIR}/qt-${QT_VERSION}.env"
if [ "$(qmake -query QT_INSTALL_BINS)" != "${QTDIR}/bin" ]; then
debug "ERROR: unexpected Qt location."
fi
}
QT_VERSION=${1:-5.12.2}
-QT_VERSION_SHORT=${QT_VERSION//./}
+METHOD=${2:-artifactory}
# our expectation is that install-qt creates $QTDIR, $QTDIR/bin.
CACHEDIR=${HOME}/Cache
echo "https://docs.travis-ci.com/user/caching/#Fetching-and-storing-caches."
if [ "${TRAVIS_EVENT_TYPE}" = "cron" ]; then
# the cache is being used. modify it to reset expiration date.
- date > ${CACHEDIR}/timestamp
+ date > "${CACHEDIR}/timestamp"
fi
if [ -f "${CACHEDIR}/timestamp" ]; then
echo -n "Cache timestamp: "
cat "${CACHEDIR}/timestamp"
fi
else
- rm -fr ${CACHEDIR}
- mkdir -p ${CACHEDIR}
- pushd ${CACHEDIR}
- # install-qt creates the install at $PWD/Qt.
- QT_CI_PACKAGES=qt.qt5.${QT_VERSION_SHORT}.clang_64,qt.qt5.${QT_VERSION_SHORT}.qtwebengine QT_CI_DOWNLOADER="wget -nv -c" PATH=${TRAVIS_BUILD_DIR}/tools/qtci:${PATH} install-qt ${QT_VERSION}
+ rm -fr "${CACHEDIR}"
+ mkdir -p "${CACHEDIR}"
+ pushd "${CACHEDIR}"
+
+ if [ "$METHOD" = "artifactory" ]; then
+ (
+ # Do not leak keys
+ set +x
+ if [ -z "${ARTIFACTORY_API_KEY}" ]; then
+ echo "An untrusted build cannot load cache from artifactory."
+ echo "A PR from a forked repo will be an untrusted build."
+ echo "The cache can be loaded from a trusted build of the default branch."
+ echo "A PR from the original repo will be trusted, but has it's own cache."
+ echo "However, when that PR is merged it will build cache for the default branch."
+ echo "Also, the cron job should rebuild the cache for the default branch, if necessary,"
+ echo "once that flavor of build in .travis.yml makes it into the default branch."
+ exit 1
+ else
+ archive=qt-${QT_VERSION}-release-macos.tar.xz
+ curl -u "${ARTIFACTORY_USER}:${ARTIFACTORY_API_KEY}" "${ARTIFACTORY_BASE_URL}/${archive}" -o "/tmp/${archive}"
+ tar -x -J -f "/tmp/${archive}"
+ echo "export PATH=${CACHEDIR}/Qt/${QT_VERSION}/clang_64/bin:\$PATH" > "${CACHEDIR}/qt-${QT_VERSION}.env"
+ rm -f "/tmp/${archive}"
+ fi
+ )
+ else
+ # install-qt creates the install at $PWD/Qt.
+ QT_VERSION_SHORT=${QT_VERSION//./}
+ QT_CI_PACKAGES=qt.qt5.${QT_VERSION_SHORT}.clang_64,qt.qt5.${QT_VERSION_SHORT}.qtwebengine QT_CI_DOWNLOADER="wget -nv -c" PATH=${TRAVIS_BUILD_DIR}/tools/qtci:${PATH} install-qt "${QT_VERSION}"
+ rm "${CACHEDIR}"/qt-opensource*.dmg
+ fi
popd
validate
- rm ${CACHEDIR}/qt-opensource*.dmg
fi